<!DOCTYPE HTML>
<html>
<head th:include="/common/head :: head"></head>
<style>
	.row-fluid{
		max-width: 1024px;
    	/* margin: 0 auto; */
	}
	.table th{
		font-size: 24px;
		font-weight: bold;
	}
	.detailTable tbody td:nth-child(1),td:nth-child(3){
		text-align:left;
		min-width:150px;
	}
	.detailTable tbody td:nth-child(2),td:nth-child(4){
		max-width:300px;
	}
	.table td{
		font-size: 16px;
		font-family: Microsoft YaHei;
	}

</style>
<body class="pos-r">
	<div>

		<nav class="breadcrumb"
			th:include="/common/navbar :: navbar('用户管理','入会审核详情页')"></nav>

		
		<div class="container-fluid">
			<div class="row-fluid">
			
				<table class="table table-hover detailTable">
					<thead>	
						<tr>
							<th colspan="4">
							基本信息 
							</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>账号:</td><td th:text="${retMember.userCode}"></td>
							<td>地址:</td><td th:text="${retMember.provinceEntity!=null? retMember.provinceEntity.name+retMember.cityEntity.name+retMember.districtEntity.name:''}"></td>
						</tr>
						<tr>
							<td>姓名:</td><td th:text="${retMember.name}"></td>
						</tr>
						<tr>
							<td>手机号:</td><td th:text="${retMember.mobile}"></td>
							<td>公司:</td><td th:text="${retMember.company}"></td>
						</tr>
						<tr>
							<td>邮箱:</td><td th:text="${retMember.email}"></td>
							<td>职务:</td><td th:text="${retMember.position}"></td>
						</tr>
						<tr>
							<td>擅长领域:</td><td th:text="${retMember.adeptField}"></td>
							<td>著作:</td><td th:text="${retMember.writings}"></td>
						</tr>
						<tr>
							<td>荣誉:</td><td th:text="${retMember.honor}"></td>
							<td>能力/经验:</td><td th:text="${retMember.intro}"></td>
						</tr>
						<tr>
							<td colspan="4" style="text-align:center;">
								<a href="/user/audit"  class="btn btn-primary radius"><i class="Hui-iconfont">&#xe66b;</i> 返回</a>
							</td>
						</tr>						
					</tbody>
				</table>
			
			
				<table class="table table-hover detailTable">
					<thead>	
						<tr>
							<th colspan="4">
							系统信息
							</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>用户类型:</td><td th:text="${retUser != null ? retUser.userType.value :  '' }"></td>
							
							<td>申请入会:</td><td th:text="${retMember.applicationTime != null ? #dates.format(retMember.applicationTime, 'yyyy-MM-dd HH:mm:ss') :  '' }"></td>
						</tr>
						<tr>
							<td>注册时间:</td><td th:text="${retUser != null ? #dates.format(retUser.registrationTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td>
							<td>入会审核时间:</td><td th:text="${retMember.auditTime != null ? #dates.format(retMember.auditTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td>
						</tr>
						<tr>
							<td>入会审核人员:</td><td th:text="${retMember.auditUser}"></td>
							<td>入会审核说明:</td><td th:text="${retMember.auditDescription}"></td>
						</tr>
					</tbody>
				</table>
				
				<table class="table table-hover">
					<thead>	
						<tr>
							<th>
							活动记录
							</th>
						</tr>
					</thead>
					<tbody>
						<tr class="text-c va-m" th:each="vo,voStat : ${activityLogs}">
							<td class="text-l" th:text="${vo.updateTime != null ? #dates.format(vo.updateTime, 'yyyy-MM-dd HH:mm:ss') : ''}"></td>
							<td class="text-l" >
							<a style="color:blue" th:href="@{/activity/user/view(id=${vo.activityUserId})}" th:text="${vo.activityUser.name}"></a>
							<span th:text="${vo.status.value + '活动'}"></span>
							<a style="color:blue" th:href="@{/activity/view(id=${vo.activity.id})}" th:text="${'&quot;' + vo.activity.name + '&quot;'}"></a>
							<span th:text="${vo.status.value == '未通过' ? '审核' : ''}"></span>
							<span th:text="${vo.status.value == '通过了' ? '审核' : ''}"></span>
							;
							</td>
						</tr>
					</tbody>
				</table>
				
				
				<table class="table table-hover ">
					<thead>	
						<tr>
							<th colspan="4"  >
							会员审核  
							</th>
						</tr>
						<tr>
							<td colspan="4"  >
							审核结果  <span id="auditResult" style="margin-left: 15px;" th:text="${retMember.auditStatus.value}"></span>
							</td>
						</tr>						
					</thead>

					<tbody>
						<tr>
							<td colspan="2" style="text-align: right;">
								<button class="btn btn-primary radius size-L  actiAuditButton"  data-value="P">
									通过
								</button>
							</td>
							
							<td colspan="2">
								<button class="btn btn-primary radius size-L actiAuditButton" data-value="N">
									未通过
								</button>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>

	
	
	<!-- 弹出审核说明窗口 -->
	<div id="actiAuditModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content radius">
				<div class="modal-header">
					<h3 class="modal-title">审核说明</h3>
					<h6>您可以输入<span>90</span>个字，现在剩余<span id="word">90</span>个</h6>
					<a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
				</div>
				<div class="modal-body">
					<label>说明</label>
					<textarea class="textarea radius"  id="auditDescription" maxlength="90"></textarea>
				</div>
				<div class="modal-footer">
					<button class="btn btn-primary actiAuditConfirm" >确定</button>
					<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
				</div>
			</div>
		</div>
	</div>
	
	
	
	<input type="hidden" id="status" />
	<input type="hidden" id="memberId" th:value="${retMember.id}"/>
	
	<script type="text/javascript"
		src="/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>


	<script type="text/javascript">
	
		$(function(){
			$(".actiAuditButton").on("click",function(){
				$("#status").val($(this).data("value"));
				$('#actiAuditModal').modal('show');
				
			})
			
			$(".actiAuditConfirm").on("click",function(){
				//逻辑处理
				var auditDescription = $("#auditDescription").val();
				if(auditDescription.length >　1000){
					$.Huimodalalert('输入字数过多，请重新输入！',2000);
					return ;
				}
				var auditResultText = "通过";
				var auditResult = $("#status").val();
				var memberId = $("#memberId").val();
				
				if(auditResult == "N"){
					auditResultText = "未通过";
				}
				
		    	$.ajax({
		               type : "POST",
		               url : "/user/updateAudit",
		               data : {
		            	   id : memberId,
		            	   auditDescription : auditDescription,
		            	   auditStatus : auditResultText
			       	   },
		               success : function(data){
		            	   alert('操作成功');
			   			   location.reload();
			   			  
		               },error : function(data){
			       		  $.Huimodalalert('操作失败',2000);
		        	   }
		         }); 
		    	$('#actiAuditModal').modal('hide');

			})
			
		    $("#auditDescription").keyup(function(){
			   var len = $(this).val().length;
			   if(len > 89){
			    $(this).val($(this).val().substring(0,90));
			    $.Huimodalalert('输入字数过多，请重新输入！',2000);
			   }
			   var num = 90 - len;
			   $("#word").text(num);
			  });
			
		})
	</script>
</body>
</html>